<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	layout:decorator="layout/default">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>系统用户列表</title>
</head>
<body>
	<div layout:fragment="content">
		<div class="row" style="margin-bottom: 12px;">
			<div th:replace="fragments/searchBox::topSearch"></div>
			<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
				<shiro:hasPermission name="authUser:new">
					<a type="button" class="btn btn-sm btn-success pull-right"
						title="创建新用户" th:href="@{/users/new}">创建新用户</a>
				</shiro:hasPermission>
			</div>
		</div>
		<div class="row">
			<div class="col-lg-12 col-md-12 col-sm-12 xol-xs-12">
				<div th:unless="${#lists.isEmpty(page.list)}"
					th:replace="auth/user/index::showUsers(${page.list})"></div>
				<div
					th:replace="fragments/pagination::pagination(${'/users'}, ${page})"></div>
			</div>
		</div>
	</div>

	<div class="table-responsive" th:fragment="showUsers(userList)">
		<table class="table table-striped table-hover table-condensed">
			<thead>
				<tr>
					<th>登录名称</th>
					<th>显示昵称</th>
					<th>电子邮件</th>
					<th>状态</th>
					<th>创建时间</th>
					<th>更新时间</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<tr data-th-each="user, state: ${userList}" data-th-object="${user}">
					<td><a data-th-href="@{'/users/' + *{userId}}"
						data-th-text="*{userName}"></a></td>
					<td data-th-text="*{nickName}"></td>
					<td><a data-th-text="*{email}"
						th:href="@{'mailto:' + *{email}}"></a></td>
					<td data-th-text="*{state}"></td>
					<td><span th:if="*{createdTime}"
						th:text="*{#dates.format(createdTime, 'yyyy-MM-dd HH:mm:ss')}"></span></td>
					<td><span th:if="*{updateTime}"
						th:text="*{#dates.format(updateTime, 'yyyy-MM-dd HH:mm:ss')}"></span></td>
					<td>
						<div class="btn-toolbar pull-right hidden-print">
							<div class="btn-group btn-group-xs">
								<shiro:hasPermission name="authUser:edit">
									<a class="btn btn-default" title="修改用户资料"
										th:href="@{/users/{id}/edit(id=*{userId})}">编辑</a>
								</shiro:hasPermission>
								<shiro:hasPermission name="authUser:change-password">
									<a class="btn btn-default" title="修改登录密码"
										th:href="@{/users/{id}/change-psd(id=*{userId})}">修改密码</a>
								</shiro:hasPermission>
								<shiro:hasPermission name="authUser:delete">
									<a class="btn btn-danger" title="删除该用户"
										onclick="if(confirm('确定删除?')==false)return false;"
										th:href="@{/users/{id}/del(id=*{userId})}">删除</a>
								</shiro:hasPermission>
							</div>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</body>
</html>
